var ajaxHelper = require("../../utils/ajaxhelp");
const serviceUrl = getApp().globalData.serviceUrl;
let token = wx.getStorageSync('token');

//根据潜客Id获取筛查客户信息
const GetScreenCustomerByLeadId = (leadId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCustomer/GetScreenCustomerByLeadId", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		leadId: leadId
	})
}

const GetScreenCustomerByScreenIdAndSCStaceAndKeyPaging = (scid, scstate, key, pageIndex, pageSize) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCustomer/GetScreenCustomerByScreenIdAndSCStaceAndKeyPaging", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		scid: scid,
		scstate: scstate,
		key: key,
		pageIndex: pageIndex,
		pageSize: pageSize
	})
}
const GetScreenCustomerByScreenIdAndLeadId = (scid, customerId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCustomer/GetScreenCustomerByScreenIdAndCustomerId", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		scid: scid,
		customerId: customerId
	})
}
const GetSameNameQuantity=(scid,fullname)=>{
  token = wx.getStorageSync('token');
  return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCustomer/GetCountScreenCustomerBySCNumAndFullName", {
    'Authorization': 'Bearer ' + token
  }, "GET", {
      scid: scid,
      fullname: fullname
    })
}
const GetAllHospital = () => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Hospital/Get", {
		'Authorization': 'Bearer ' + token
	}, "GET", null)
}
const GetDepartmentByHospitalId = (hospitalId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Department/GetDepartmentByHospitalId", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		hospitalId: hospitalId
	})
}
module.exports = {
	GetScreenCustomerByLeadId,
	GetScreenCustomerByScreenIdAndSCStaceAndKeyPaging,
	GetAllHospital,
	GetDepartmentByHospitalId,
	GetScreenCustomerByScreenIdAndLeadId,
  GetSameNameQuantity
}
